#pragma once

#include <boost/shared_ptr.hpp>
#include "Approach.h"
#include "EphemWrapper.h"
#include "Integrator.h"
#include "rada.h"

class TrajTrace
{
public:
	typedef boost::shared_ptr<TrajTrace> Ptr;
public:
	TrajTrace()
	{
		memset(x, 0, sizeof(x));
		memset(v, 0, sizeof(v));
	}
	TrajTrace(const Body &body)
	{
		memcpy(x, body.x, sizeof(x));
		memcpy(v, body.v, sizeof(v));
	}
	double x[3];
	double v[3];
};

typedef map<double, TrajTrace::Ptr> TimePosTrace;


class CTrajectory: public IForceInterface, public ISimpleIntegratorInterface
{
public:
	CTrajectory(LPCTSTR stzEphemFile, double dParam);
	~CTrajectory();

	ListApproachPtr Move(double dStartTime, double dEndTime, Body &body, TimePosTrace * pTrace);
	bool SimpleMove(double start, double end, Body &body);
protected:
	bool Force(int nv, double time, double *x, double *f);
protected:
	CEphemWrapper		m_ephem;
	auto_ptr<Everhardt>	m_pRada;
	double				m_dStep;
	auto_ptr<CApproachSearcher> m_pAppSearcher;
};

